<?php
my_component_load('testing' , false);
my_component_load('paging' , false);  
my_component_load('data_setting', false);
my_component_load('nipar' );
$task = isset($_GET['task']) ? $_GET['task'] : ""; 
$id = isset( $_GET['id'] ) ? $_GET['id']:  0;
$modulname = "Admin _BN_ Konfigurasi Data";
if($_SERVER['REQUEST_METHOD'] == "POST" ):
    $validatepost = form_nipar_validate($id);
	if($validatepost){
		$content = message_multi_error($validatepost);
		$content .= form_nipar_create($id);
		generate_my_web($content,"","plain.php");
		exit; 
	}else{
		form_nipar_submit($id);
		$content =  "Updated";
		generate_my_web($content,"","plain.php");
		exit;
	}
	my_direct('index.php?com=nipar');
	break;
else:  	
	if($task == 'page'){
		$content  = form_nipar_create($id);
		generate_my_web($content,"","plain.php");
		exit; 	
	}elseif($task =='edit'){
		$pagename= ($id > '0' ) ?  "Perubahan Data" : "Tambah Data";
		facebox_page('index.php?com=nipar&task=page&id='.$id , $pagename , 210	); 			
	}else{
		$pagename = 'Nipar'; 
		load_facebox_script();	
		$view = list_nipar();
		$href = 'index.php?com=nipar&task=edit' ;				
	}  
endif;

$content = spliter_browser( $view , $pagename ,$href);
generate_my_web($content, $modulname." _BN_ Nipar" );
?>